Repository navigation
fix(weibo): decouple NoWM evaluation state from CacheStandardVersion - #254
Conversation
Decouple Weibo /oslarge/ watermark-free companion evaluation from
CacheStandardVersion via optional item.json field weiboNoWMState
("" | "pending" | "checked", zero schema version bumps) so disabling
WeiboRemoveWatermark never skips quality or historical backfill on
static-image/mixed posts.
- internal/library: add ItemMetadata.WeiboNoWMState, constants
WeiboNoWMStatePending/WeiboNoWMStateChecked, sanitization (Weibo-only
allowlist), merge precedence (checked > pending > ""), portable
manifest round-trip, and decoupled WeiboNeedsNoWMBackfill with full
legacy v3-v6 404 compatibility.
- internal/download & internal/service: remove removeWM==false skips
in weiboNeedsQualityBackfill, weiboNeedsHistoricalOtherBackfill, and
weiboCanStampV4Tier0; stamp v6 + "pending" when removeWM==false and
transition "pending" -> "checked" in BackfillWeiboNoWMCompanions
(preserving v6 on Fast CDN Bucket B) and executeWeiboPostTask.
- docs/design: document weiboNoWMState in data-and-cache.md and
subscriptions.md.
- tests: add unit and E2E regression tests covering removeWM=false
upgrade convergence, subsequent removeWM=true Fast CDN Bucket B
catch-up (200 OK and 404), and legacy v3-v6 404 non-refetch.
Verification: go run ./tools/check passed (12m17.842s); real-site
requests not-run (synthetic fixtures only).
Signed-off-by: chialecode <315431287+chialecode@users.noreply.github.com>
|
Agent:独立干净上下文审查( 审查结论需要修改(先修复) 核心方案(以可选 阻塞问题
非阻塞建议(至多 3 条)
已审查范围与未覆盖项
|
Address PR #254 review findings: - In applyWeiboPostStandardAndNoWMState, require saved local static images (library.WeiboHasStaticImageSlots) and all non-dead planned static pages saved before stamping WeiboNoWMState="checked", preventing 0-image or transient partial stubs from overriding "pending" during multi-node merges. - Guard weiboCanStampV4Tier0 with meta.SkipAutoRecheck and remove removeWM from stampWeiboStandardAndNoWMState so pure offline Tier 0 / Tier A paths never fabricate "checked" when /oslarge/ was not evaluated. - Preserve evaluated legacy v3-v6 static-image items as "checked" when MergeItemMetadata merges them with a v6+"pending" peer. - Add synthetic unit tests covering all three behaviors. Signed-off-by: chialecode <315431287+chialecode@users.noreply.github.com>
|
Agent:已修复全部 2 项 P2 与 1 项非阻塞建议(提交
验证证据(
|
|
Agent:复审结论( 审查结论可合并(技术审查通过;合并前仍须等待当前头提交 阻塞项复核结果
合规与门禁核验(提交
|
Closes #252
做了什么
将微博无水印伴侣图(
/oslarge/、images/NN_nowm.<ext>)的评估状态与CacheStandardVersion解耦(对应 FR-CACHE-006、FR-CACHE-010、DEC-078、DEC-079、DEC-096,保持item.jsonv1、library.dbv2、cache-queue.jsonv3 零结构版本升级),彻底消除关闭「微博同时保存无水印版(WeiboRemoveWatermark == false)」时跳过静图/混排帖画质与历史补全的缺陷:internal/library/schema.go、internal/library/merge.go):ItemMetadata.WeiboNoWMState(json:"weiboNoWMState,omitempty")及常量WeiboNoWMStatePending = "pending"、WeiboNoWMStateChecked = "checked",新增辅助函数WeiboHasStaticImageSlots与WeiboNoWMAlreadyEvaluated。SanitizeItemMetadata/PortableManifest仅允许微博站点保留""/"pending"/"checked",非微博站点与非法值统一清洗置空;MergeItemMetadata按"checked">"pending">""合并。WeiboNeedsNoWMBackfill(meta, removeWatermark):"checked"返回false;"pending"在removeWatermark == true下检查len(WeiboStaticImageSlotsMissingNoWM(meta)) > 0;旧版WeiboNoWMState == ""继续沿用CacheStandardVersion < WeiboNoWMStandardVersion (3)规则,保证既往v3–v6404/oslarge/条目零重复请求。removeWM == false整体跳过并补全状态流转(internal/download/weibo_plan.go、internal/download/weibo_backfill.go、internal/service/backfill.go、internal/service/cache_conflicts.go):weiboNeedsQualityBackfill与weiboNeedsHistoricalOtherBackfill中!removeWM && len(WeiboStaticImageSlotsMissingNoWM(meta)) > 0的提前跳过,更新weiboCanStampV4Tier0在removeWM == false下不再阻断v6打标。executeWeiboPostTask(applyWeiboPostStandardAndNoWMState)、BackfillWeiboNoWMCompanions、Tier A 离线链接升级与 Tier 0 元数据回写(stampWeiboStandardAndNoWMState)中统一维护WeiboNoWMState:关闭无水印完成缓存/升级/核验且存在未评估静图槽位时写v6 + "pending"立即收敛(已评估过的旧v3–v6静图槽位保留"checked");开启无水印并评估全部静图槽位后置"checked"(BackfillWeiboNoWMCompanions/ Bucket B 快速 CDN 处理v6 + "pending"条目时正常下载NN_nowm或收敛 404,保留v6不降级)。docs/design/data-and-cache.md、docs/design/subscriptions.md。TestWeiboNoWMStateSanitizeMergeAndPortableRoundTrip、TestWeiboCacheStandardVersionAndOfflineHelpers解耦分支、TestWeiboNoWMStateDecoupledStampingAndV6PendingFastCDNBackfill、TestWeiboNoWMDecoupledRemoveWMFalseQualityBackfillThenToggleTrueFastCDN,并同步强化TestDEC096WeiboBackfillTierC2BackoffClearOrderAndRemoveWatermarkFalseNoLoop。验证
go run ./tools/check(退出码 0,总耗时12m17.842s,基于提交fc36527):gofmt -l: OK (385ms)go vet ./...: OK (9.467s)go test ./...: OK (11m37.715s,全部包非缓存完整执行通过,含internal/library35.436s、internal/download164.426s、internal/service151.163s)dependency direction: OK (2.821s)trace-server linux build: OK (25.297s)tools/checkdocs: OK (2.034s,未找到本地参考索引,公开内容与链接校验通过)git diff --check HEAD: OK (123ms)-count=1):go test -count=1 -v -run "TestWeiboNoWMState|TestWeiboCacheStandardVersionAndOfflineHelpers|TestBackfillWeiboNoWMCompanions|TestDEC096WeiboBackfillTierC2BackoffClearOrderAndRemoveWatermarkFalseNoLoop|TestWeiboNoWMDecoupledRemoveWMFalseQualityBackfillThenToggleTrueFastCDN|TestWeiboTierC2AbbreviatedPostAndWatermarkOffNeverFetchesOSLargeOrStampsV5|TestWeiboOptionalNoWMCompanion418DoesNotTripBackoffOrFailPrimary" ./internal/library ./internal/download ./internal/service(全部 PASS)repository-quality(建 PR 后自动执行)not-run:真实站点请求(本次仅使用合成夹具验证,0 次真实请求至微博);tools/uishots/tools/package -install(未改动界面、打包或安装路径)。git worktree中开发,已先完整通过go run ./tools/check;按LESSONS.md推送时使用git push --no-verify以规避pre-push钩子注入GIT_DIR导致tools/release测试污染 worktree 引用的已知问题。风险
风险等级:低风险
tools/package、tools/release、internal/credential、internal/sitecheck、tools/actcheck、.github/;未修改任何持久化数据文件结构版本,保持item.jsonv1、library.dbv2、cache-queue.jsonv3;未删除或弱化既有测试)。weiboNoWMState字段的v3–v6静图清单保持完全向后兼容,不会触发 404/oslarge/重复抓取。每个提交都带
Signed-off-by(git commit -s)。